<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./dist/minivue.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h2>模板语法测试</h2>
      姓名：{{myInfo.name}} <br>
      年龄：{{myInfo.age}} <hr>
      <h2>单向数据绑定测试</h2>
      <input type="text" :value="myInfo.name">
      <h2>双向数据绑定测试</h2>
      <input type="text" v-model="myInfo.name">
      <h2>计算属性测试</h2>
      根据年龄计算生日：{{birthday}}
      <button @click="change">修改年龄</button>
    </div>
    <script>
      const vm = new MiniVue({
        el: '#app',
        data: {
          hobby: ['basketball', 'study', 'football'],
          myInfo: {
            name: 'zhudadi',
            gender: 'male',
            age: 24,
            schoole: 'Xiamen university'
          }
        },
        computed: {
          birthday() {
            return 2022 - this.myInfo.age
          }
        },
        methods: {
          change() {
            this.myInfo.age++
          }
        }
      })
      console.log(vm)
    </script>
  </body>
</html>
